var ResUploadView = Backbone.View.extend({
	tagName : 'dl',
	template : _.template($('#item-template').html()),
	events: {
      "click .dlg-sys-btn-cls" : "close",
      "click .dlg-sys-btn-min" : "min",
	  "click .dlg-sys-btn-max" : "max"
    },
	initialize: function() {
        _.bindAll(this, 'render','close');
        // 每次更新模型后重新渲染
		this.model.bind('change', this.render, this);
    },
    render: function() {
    	$(this.el).html(this.template(this.model.toJSON()));
    	 return this;
    },
    unrender: function() {
        $(this.el).remove();
    },
    close:function(e){
    	e.preventDefault();
    	this.unrender();
    },
    min:function(e){
    	e.preventDefault();
    	var $this = this.$(".dlg-sys-btn-min");
    	if($this.hasClass("dlg-sys-btn-min")){
    		$(".dlg-upload-content",this.el).animate({
			    height: '0'
			  }, 500, function() {
		  });
    		$this.removeClass('dlg-sys-btn-min').addClass("dlg-sys-btn-max");
    	}
    	
    },
    max:function(e){
    	e.preventDefault();
    	var $this = this.$(".dlg-sys-btn-max");
    	if($this.hasClass("dlg-sys-btn-max")){
    		$(".dlg-upload-content",this.el).animate({
			    height: '200'
			  }, 500, function() {
		  });
    		$this.removeClass('dlg-sys-btn-max').addClass("dlg-sys-btn-min");
    	}
    },
    save:function(){
    	this.model.set({'a':'1','b':'2' });
        this.model.save();
    }
});